﻿function GetThings() {
    ScottCateAjax2008.Services.CustomNouns.GetNouns(GetThings_CallBack, GetThings_TimeOut, GetThings_Error);
    return true;
}

function GetThings_CallBack(things) {
    var content = new ScottCate.StringBuilder("<table border=1>");
    for(r=0; r < things.length; r++) {
        // declare dr variable, which will hold a single row of our datatable
        var row = things[r];
        content.append("<tr>");
        content.appendFormat("<td>{0}</td>", row['Name']);
        var nounContent = row["Noun"];
        if(typeof(row["Noun"]) == 'object')
            nounContent = row["Noun"].Nouns;
        content.appendFormat("<td>{0}</td>", nounContent);
        content.append("</tr>");
     }
    content.append("</table>");
    
    $get("ThingsList").innerHTML = content.toString();
}

function GetThings_Error(res) { alert('Error in GetThings'); }
function GetThings_TimeOut(res) { 
    alert('TimeOut in GetThings' + res._message); 
    }
    
function ClearThings() {
    document.getElementById("ThingsList").innerHTML = "";
}
